package com.example.admin.goodnews.fragment.ZaiXianYinYue;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.admin.goodnews.R;
import com.example.admin.goodnews.adapter.FragmentAdapter;
import com.hitomi.smlibrary.OnSpinMenuStateChangeListener;
import com.hitomi.smlibrary.SpinMenu;

import java.util.ArrayList;
import java.util.List;

/**
 * 排行榜歌单页面
 * Created by admin on 2016/10/18.
 */

public class ZaiXianYinYueFragment extends Fragment {
    private TabLayout tablayout_zaixianyinyue;
    private ViewPager viewpager_zaixianyinyue;
    private FragmentAdapter fragmentAdapter;
    private List<String> hintStrList;
    private List<Fragment> fragmentList;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_zaixianyinyue, null);
        viewpager_zaixianyinyue = (ViewPager) view.findViewById(R.id.viewpager_zaixianyinyue);
        tablayout_zaixianyinyue = (TabLayout) view.findViewById(R.id.tablayout_zaixianyinyue);

        initData();
        return view;
    }

    private void initData() {
        // 设置页面标题
        hintStrList = new ArrayList<>();
        hintStrList.add("排行榜类型");
        hintStrList.add("查找歌曲");
        // 设置页面适配器
        fragmentList = new ArrayList<>();
        fragmentList.add(PaiHangBangLeiXingFragment.newInstance());
        fragmentList.add(PaiHangBangSouSuoFragment.newInstance());
        fragmentAdapter = new FragmentAdapter(getChildFragmentManager(), hintStrList, fragmentList);
        viewpager_zaixianyinyue.setAdapter(fragmentAdapter);
        tablayout_zaixianyinyue.setupWithViewPager(viewpager_zaixianyinyue);
    }

}
